<?php
/**	
*	FILENAME: 		/server_app/registration_status.php
*	DESCRIPTION:	This script creates a valid JSON response that provides the user's registration status.
*	AUTHOR:			Vincent Veltri
*	VERSION:		1.0.0
*	LAST MODIFIED:	2/10/10
**/

require_once($_SERVER['DOCUMENT_ROOT'] . "/libraries/users.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/libraries/functions.php");

enforceSSL();

$userName = $_POST["username"];

if (strlen($userName) == 0) {
	// Inproper Data
	$response["response_type"] = "error";
	$response["error_desc"] = "Username Not Provided.";
	echo(json_encode($response));
	die();
} 

$userID = getUserIDValue($userName);

if ($userID !== FALSE) {
	$response["response_type"] = "success";
	$response["registered"] = "yes";
	$response["UID"] = $userID;
	echo(json_encode($response));
} else {
	$response["response_type"] = "success";
	$response["registered"] = "no";
	echo(json_encode($response));
}